#!/usr/bin/env python
import threading
import Queue
import time
global su
su=0
li=[10,10,10,10,10,10]
s=3
t=0
threadLock = threading.Lock()
class ThreadDemo(threading.Thread):
    def __init__(self,ob):
        threading.Thread.__init__(self)
        self.ob=ob
        #self.start()
        
    def run(self):
        threadLock.acquire()
        global su
        threadLock.release()
        print "ob is ob:",self.ob
        for i in range(10):
            print "%s" % (time.ctime(time.time())), "no",i,self.ob
            #print t.getName()
            time.sleep(1)
       
            
    def stop(self):
        self.thread_stop = True

print "%s" % (time.ctime(time.time()))

for i in range(len(li)):
    sou=li[t:s]
    print sou
    t+=3
    s+=3
    for th in range(len(sou)):
        t=ThreadDemo(sou[th])
        t.setDaemon(True)
        print t.getName()
        t.start()
    
    if t > len(li):
        break
    
t.join()
print su
print "%s" % (time.ctime(time.time()))